import "./assets/main.css";

import { createApp } from "vue";
import App from "./App.vue";

createApp(App).mount("#app");

// const sendMessage = async () => {
//   if (!userInput.value.trim()) return;
//   isLoading.value = true;
//   conversation.value.push({ role: 'user', content: userInput.value });

//   try {
//     const response = await openai.chat.completions.create({
//       model: 'deepseek-chat',
//       messages: conversation.value,
//       stream: true, // 启用流式响应
//     });

//     let aiResponse = '';
//     conversation.value.push({ role: 'assistant', content: 'Sorry, something went wrong.' });
//     for await (const chunk of response) {
//       aiResponse += chunk.choices[0]?.delta?.content || '';
//       conversation.value[conversation.value.length - 1].content = aiResponse;
//     }
//   } catch (error) {
//     console.error('Error:', error);
//     conversation.value.pop()
//     conversation.value.push({ role: 'assistant', content: 'Sorry, something went wrong.' });
//   } finally {
//     isLoading.value = false;
//     userInput.value = '';
//     await nextTick();
//     document.querySelector('textarea')?.focus();
//   }
// };
